Skip to content

feat(experimentation): enable rollout override on experiment start [WIP]#7870

Closed
gagantrivedi wants to merge 1 commit into
mainfrom
feat/experiment-start-enables-rollout-override
Closed

feat(experimentation): enable rollout override on experiment start [WIP]#7870
gagantrivedi wants to merge 1 commit into
mainfrom
feat/experiment-start-enables-rollout-override

Conversation

@gagantrivedi

Copy link
Copy Markdown
Member

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Contributes to

Warning

WIP — opening early for visibility/feedback.

Follow-up to #7851 / #7858. Until now, the rollout segment override created with an experiment went live as soon as it was configured (it took spec.enabled at rollout time), and start only flipped the experiment's status. This wires the two together: starting an experiment enables its rollout segment override so it actually serves its split to traffic.

  • transition_experiment_status enables the rollout override when moving to RUNNING, inside the existing transaction.
  • New enable_experiment_rollout(experiment, request) service reads the current rollout via the merged get_experiment_rollout() (which already reassembles enabled / feature_state_value / multivariate_feature_state_values the v1/v2-aware way), then re-applies it through update_flag with enabled=True. The value is taken from the fetched representation via ExperimentRolloutSerializer.to_spec; multivariate allocations are omitted so update_flag preserves them. No new value-reconstruction logic and no changes to shared versioning code.
  • No-op when the experiment has no rollout, or the override is already enabled.

Pause/complete are intentionally left untouched for now (start path only).

How did you test this code?

Unit tests (all green locally) + mypy, ruff, flagsmith-lint-tests, and docgen events (no catalogue diff).

  • Service: start enables a disabled override (v1 and v2 — v2 publishes a new version with the value preserved); already-enabled and no-rollout are no-ops (asserted no update_flag write).
  • API: POST .../experiments/{id}/start/ flips the rollout segment override's enabled to true end-to-end (for both session-user and master-API-key auth).
  • Full tests/unit/experimentation/ suite passes (411) — no regression.

@vercel

vercel Bot commented Jun 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Preview Jun 26, 2026 6:49am
flagsmith-frontend-preview Ignored Ignored Preview Jun 26, 2026 6:49am
flagsmith-frontend-staging Ignored Ignored Preview Jun 26, 2026 6:49am

Request Review

@github-actions github-actions Bot added api Issue related to the REST API feature New feature or request labels Jun 25, 2026
@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.56%. Comparing base (d79ed7e) to head (ec2772b).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7870      +/-   ##
==========================================
- Coverage   98.61%   98.56%   -0.06%     
==========================================
  Files        1484     1487       +3     
  Lines       58287    58446     +159     
==========================================
+ Hits        57481    57605     +124     
- Misses        806      841      +35     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Starting an experiment now enables its rollout segment override so it
serves its split to traffic. transition_experiment_status enables the
override when moving to RUNNING, re-applying the existing override via
update_flag with enabled=True (value/allocations preserved). No-op when
the experiment has no rollout or the override is already enabled.
@gagantrivedi gagantrivedi force-pushed the feat/experiment-start-enables-rollout-override branch from e9a15f2 to ec2772b Compare June 26, 2026 06:49
@github-actions github-actions Bot added feature New feature or request and removed feature New feature or request labels Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant